import { ShopauthMiddleware } from './../../middleware/shopauth.middleware';
import { CommonModule } from './../common/common.module';
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { IndexController } from './index/index.controller';
import { UserController } from './user/user.controller';
import { AddressController } from './address/address.controller';
import { BuyController } from './buy/buy.controller';
import { PassController } from './pass/pass.controller';
import { CartController } from './cart/cart.controller';
import { ProductController } from './product/product.controller';
// import { RedisModule } from '@liaoliaots/nestjs-redis';
import { CategoryController } from './category/category.controller';
import config from 'src/config/config';

@Module({
    imports: [CommonModule],
    controllers: [
        IndexController,
        UserController,
        AddressController,
        BuyController,
        PassController,
        CartController,
        ProductController,
        CategoryController,
    ],
    providers: [],
})
export class DefaultModule implements NestModule {
    configure(consumer: MiddlewareConsumer) {
        consumer.apply(ShopauthMiddleware).forRoutes(...config.shopauthRoutes);
    }
}
